<html><head><title>Sprite.pb</title></head>
<body bgcolor="#FFFFDF" link="#009999" vlink="#006666" alink="#006666">
<pre><font face="Courier New, Courier, mono"size="2"><font color="#006666">;
</font><font color="#006666">; ------------------------------------------------------------
</font><font color="#006666">;
</font><font color="#006666">;   PureBasic - Sprite example file
</font><font color="#006666">;
</font><font color="#006666">;    (c) Fantaisie Software
</font><font color="#006666">;
</font><font color="#006666">; ------------------------------------------------------------
</font><font color="#006666">;
</font>
<b><font color="#006666">If</font></b> <font color="#006666">InitSprite</font>() = 0 <b><font color="#006666">Or</font></b> <font color="#006666">InitKeyboard</font>() = 0
<font color="#006666">  MessageRequester</font>("Error", "Sprite system can't be initialized", 0)
  <b><font color="#006666">End</font></b>
<b><font color="#006666">EndIf</font></b>

<font color="#006666">;
</font><font color="#006666">; Now, open a 800*600 - 32 bits screen
</font><font color="#006666">;
</font><b><font color="#006666">If</font></b> <font color="#006666">OpenScreen</font>(800, 600, 32, "Sprite")

  <font color="#006666">; Load our 16 bit sprite (which is a 24 bit picture in fact, as BMP doesn't support 16 bit format)
</font>  <font color="#006666">; 
</font><font color="#006666">  LoadSprite</font>(0, <font color="#924B72">#PB_Compiler_Home</font> + "examples/sources/Data/PureBasic.bmp")
<font color="#006666">  CopySprite</font>(0, 1, 0)
  
  <b><font color="#006666">Repeat</font></b>
    
    <font color="#006666">; Inverse the buffers (the back become the front (visible)... And we can do the rendering on the back)
</font>    
<font color="#006666">    FlipBuffers</font>()
    
<font color="#006666">    ClearScreen</font>(<font color="#006666">RGB</font>(0,0,0))
    
    <font color="#006666">; Draw our sprite
</font>
<font color="#006666">    ClipSprite</font>(0, 0, 0, x, x/8)
     
<font color="#006666">    DisplaySprite</font>(0, x, 100)
<font color="#006666">    DisplaySprite</font>(1, x, x)
<font color="#006666">    DisplaySprite</font>(0, 600-x, x)
    
    x+1
    
<font color="#006666">    ExamineKeyboard</font>()
  <b><font color="#006666">Until</font></b> <font color="#006666">KeyboardPushed</font>(<font color="#924B72">#PB_Key_Escape</font>)
  
<b><font color="#006666">Else</font></b>
<font color="#006666">  MessageRequester</font>("Error", "Can't open a 800*600 - 32 bit screen !", 0)
<b><font color="#006666">EndIf</font></b>
</font></pre>
</body></html>
